package com.czsth.home.daos;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import javax.sql.DataSource;

/**
 * Auth: bruce-sha
 * Date: 2015/3/4
 */
//@Repository
public class CommonDAO {

//    @Autowired
    protected DataSource dataSource;

//    public CommonDAO() {
//
//        try {
//            Connection conn = dataSource.getConnection();
//
//            Statement stmt = conn.createStatement();
//
//            stmt.executeUpdate("CREATE TABLE TEST_MEM(ID INT PRIMARY KEY,NAME VARCHAR(255));");
//            stmt.executeUpdate("INSERT INTO TEST_MEM VALUES(1, 'Hello_Mem');");
//            stmt.executeUpdate("INSERT INTO TEST_MEM VALUES(2, 'Hello_Mem');");
//            stmt.executeUpdate("INSERT INTO TEST_MEM VALUES(3, 'Hello_Mem');");
//            stmt.executeUpdate("INSERT INTO TEST_MEM VALUES(4, 'Hello_Mem');");
//            stmt.executeUpdate("INSERT INTO TEST_MEM VALUES(5, 'Hello_Mem');");
//
//            stmt.executeUpdate("INSERT INTO TEST_MEM VALUES(6, 'Hello_Mem');");
//
//
//            ResultSet rs = stmt.executeQuery("SELECT * FROM TEST_MEM");
//            while (rs.next()) {
//                System.out.println(rs.getInt("ID") + "," + rs.getString("NAME"));
//            }
//            conn.close();
//        } catch (Exception e) {
//            System.out.println(e);
//        }
//
//    }
}
